#include<iostream>
#include<string>
using namespace std;
bool check(int breath, int pulse)
{
    return (15 <= breath && breath <= 20) && (50 <= pulse && pulse <= 70);
}
int main()
{
    int n; cin >> n;
    while (n--)
    {
        string name; cin >> name;
        int breath, pulse;
        cin >> breath >> pulse;
        if (check(breath, pulse)) continue;
        cout << name << endl;
    }
    return 0;
}